
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module newlib.series</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="newlib.html"><font color="#ffffff">newlib</font></a>.series</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/sdawson/svn/code/smap/newlib/series.py">/home/sdawson/svn/code/smap/newlib/series.py</a></font></td></tr></table>
    <p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="Queue.html">Queue</a><br>
<a href="newlib.SmapPoint.html">newlib.SmapPoint</a><br>
<a href="newlib.SmapSubscription.html">newlib.SmapSubscription</a><br>
</td><td width="25%" valign=top><a href="collections.html">collections</a><br>
<a href="logging.html">logging</a><br>
<a href="numpy.html">numpy</a><br>
</td><td width="25%" valign=top><a href="operator.html">operator</a><br>
<a href="sys.html">sys</a><br>
<a href="threading.html">threading</a><br>
</td><td width="25%" valign=top><a href="time.html">time</a><br>
<a href="newlib.util.html">newlib.util</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#tuple">__builtin__.tuple</a>(<a href="__builtin__.html#object">__builtin__.object</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial">Resampled
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="newlib.series.html#SmapSeries">SmapSeries</a>
</font></dt></dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="SmapSeries">class <strong>SmapSeries</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;class&nbsp;representing&nbsp;the&nbsp;timeseries&nbsp;from&nbsp;a&nbsp;single&nbsp;sMAP&nbsp;source.<br>
&nbsp;<br>
Instantiate&nbsp;using&nbsp;the&nbsp;stream&nbsp;identifier&nbsp;obtained&nbsp;from&nbsp;the&nbsp;sMAP<br>
management&nbsp;backend.&nbsp;&nbsp;These&nbsp;identifiers&nbsp;look&nbsp;like&nbsp;email&nbsp;addresses<br>
or&nbsp;XMPP&nbsp;handles;&nbsp;for&nbsp;instance,&nbsp;"10@jackalope.cs.berkeley.edu/django".<br>
&nbsp;<br>
Once&nbsp;so&nbsp;instantiated,&nbsp;historical&nbsp;and&nbsp;real-time&nbsp;data&nbsp;are&nbsp;available<br>
using&nbsp;this&nbsp;object.&nbsp;&nbsp;For&nbsp;stored&nbsp;data,&nbsp;there&nbsp;may&nbsp;be&nbsp;multiple&nbsp;series<br>
available,&nbsp;since&nbsp;some&nbsp;storage&nbsp;engines&nbsp;materialize&nbsp;subsampled&nbsp;or<br>
realigned&nbsp;data.&nbsp;&nbsp;For&nbsp;performance&nbsp;reasons,&nbsp;it&nbsp;is&nbsp;often&nbsp;desirable&nbsp;to<br>
select&nbsp;less&nbsp;then&nbsp;the&nbsp;full&nbsp;resolution&nbsp;when&nbsp;accessing&nbsp;data.&nbsp;&nbsp;The&nbsp;set<br>
of&nbsp;resampled&nbsp;data&nbsp;is&nbsp;available&nbsp;in&nbsp;the&nbsp;<a href="#SmapSeries">SmapSeries</a>.substreams<br>
method;&nbsp;it&nbsp;is&nbsp;a&nbsp;list&nbsp;of&nbsp;<a href="#Substream">Substream</a>&nbsp;objects.&nbsp;&nbsp;The&nbsp;user&nbsp;can&nbsp;either<br>
manually&nbsp;select&nbsp;one&nbsp;of&nbsp;these&nbsp;or&nbsp;pass&nbsp;a&nbsp;rate&nbsp;specification&nbsp;when<br>
querying&nbsp;historical&nbsp;data.<br>
&nbsp;<br>
Because&nbsp;the&nbsp;real-time&nbsp;data&nbsp;uses&nbsp;the&nbsp;sMAP&nbsp;reporing&nbsp;facility,&nbsp;it<br>
will&nbsp;not&nbsp;work&nbsp;if&nbsp;you&nbsp;are&nbsp;NAT-ed.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="SmapSeries-__init__"><strong>__init__</strong></a>(self, identifier)</dt><dd><tt>Instantiate&nbsp;a&nbsp;<a href="#SmapSeries">SmapSeries</a>,&nbsp;and&nbsp;load&nbsp;metadata&nbsp;from&nbsp;the&nbsp;storage&nbsp;engine.<br>
&nbsp;<br>
@identifier&nbsp;an&nbsp;email-address-like&nbsp;string&nbsp;specifying&nbsp;the&nbsp;stream&nbsp;in&nbsp;question.<br>
&nbsp;<br>
Raises&nbsp;ValueError&nbsp;if&nbsp;metadata&nbsp;for&nbsp;the&nbsp;stream&nbsp;could&nbsp;no&nbsp;be&nbsp;loaded.</tt></dd></dl>

<dl><dt><a name="SmapSeries-loadrange"><strong>loadrange</strong></a>(self, start, end, rate<font color="#909090">=None</font>, substream<font color="#909090">=None</font>, resample<font color="#909090">='linear'</font>, timeout<font color="#909090">=240</font>)</dt><dd><tt>Load&nbsp;data&nbsp;from&nbsp;this&nbsp;stream&nbsp;into&nbsp;a&nbsp;numpy.arpydoray,&nbsp;with&nbsp;all&nbsp;data<br>
falling&nbsp;between&nbsp;start&nbsp;and&nbsp;end.&nbsp;&nbsp;The&nbsp;series&nbsp;will&nbsp;be&nbsp;truncated&nbsp;to&nbsp;the<br>
&nbsp;&nbsp;&nbsp;most&nbsp;data&nbsp;which&nbsp;falls&nbsp;within&nbsp;that&nbsp;range.<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;@start&nbsp;unix&nbsp;timestamp&nbsp;of&nbsp;requested&nbsp;start&nbsp;of&nbsp;range<br>
&nbsp;&nbsp;&nbsp;@end&nbsp;unix&nbsp;timestamp&nbsp;of&nbsp;requested&nbsp;end&nbsp;of&nbsp;range<br>
&nbsp;&nbsp;&nbsp;@rate&nbsp;may&nbsp;be&nbsp;either&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(a)&nbsp;None:&nbsp;the&nbsp;highest-frequency&nbsp;data&nbsp;will&nbsp;be&nbsp;fetched,&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(b)&nbsp;a&nbsp;specific&nbsp;rate&nbsp;in&nbsp;seconds.&nbsp;&nbsp;data&nbsp;will&nbsp;be&nbsp;returned<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;there&nbsp;is&nbsp;an&nbsp;underlying&nbsp;subsampled&nbsp;stream&nbsp;at&nbsp;that<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rate,&nbsp;or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(c)&nbsp;a&nbsp;<a href="__builtin__.html#tuple">tuple</a>&nbsp;(min,&nbsp;max)&nbsp;of&nbsp;acceptable&nbsp;rates.&nbsp;&nbsp;The<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lowest-resolution&nbsp;data&nbsp;within&nbsp;that&nbsp;range&nbsp;will&nbsp;be<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selected;&nbsp;one&nbsp;of&nbsp;the&nbsp;endpoints&nbsp;must&nbsp;not&nbsp;be&nbsp;None.<br>
&nbsp;&nbsp;&nbsp;&nbsp;@substream&nbsp;specify&nbsp;an&nbsp;explicit&nbsp;substream&nbsp;to&nbsp;use,&nbsp;instead&nbsp;of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;picking&nbsp;one&nbsp;automatically&nbsp;based&nbsp;on&nbsp;rate.<br>
&nbsp;&nbsp;&nbsp;&nbsp;@resample&nbsp;if&nbsp;not&nbsp;None,&nbsp;a&nbsp;method&nbsp;understood&nbsp;by&nbsp;interp1d&nbsp;for&nbsp;resampling.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;None,&nbsp;an&nbsp;exception&nbsp;will&nbsp;be&nbsp;raised&nbsp;if&nbsp;the&nbsp;request&nbsp;cannot&nbsp;be&nbsp;met.<br>
&nbsp;&nbsp;&nbsp;&nbsp;@timeout&nbsp;how&nbsp;long&nbsp;to&nbsp;wait&nbsp;on&nbsp;the&nbsp;server;&nbsp;fetching&nbsp;lots&nbsp;of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data&nbsp;can&nbsp;be&nbsp;slow</tt></dd></dl>

<dl><dt><a name="SmapSeries-realtime"><strong>realtime</strong></a>(self)</dt><dd><tt>A&nbsp;generator&nbsp;for&nbsp;accessing&nbsp;real-time&nbsp;data.<br>
&nbsp;<br>
The&nbsp;iterator&nbsp;returned&nbsp;will&nbsp;block&nbsp;if&nbsp;called&nbsp;an&nbsp;no&nbsp;new&nbsp;data&nbsp;is<br>
available.&nbsp;&nbsp;To&nbsp;access&nbsp;new&nbsp;data,&nbsp;you&nbsp;would&nbsp;typically&nbsp;do:<br>
&nbsp;<br>
stream&nbsp;=&nbsp;SmapStream(ident)<br>
for&nbsp;r&nbsp;in&nbsp;stream.<a href="#SmapSeries-realtime">realtime</a>():<br>
&nbsp;&nbsp;&nbsp;print&nbsp;r.time,&nbsp;r.value<br>
&nbsp;<br>
The&nbsp;values&nbsp;are&nbsp;returned&nbsp;in&nbsp;the&nbsp;form&nbsp;of&nbsp;SmapPoint.Reading&nbsp;named&nbsp;tuples.</tt></dd></dl>

</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><strong>Substream</strong> = <a name="Substream">class Resampled</a>(<a href="__builtin__.html#tuple">__builtin__.tuple</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Resampled(period,&nbsp;phase,&nbsp;method,&nbsp;substream)<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd>Resampled</dd>
<dd><a href="__builtin__.html#tuple">__builtin__.tuple</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="Resampled-__getnewargs__"><strong>__getnewargs__</strong></a>(self)</dt></dl>

<dl><dt><a name="Resampled-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>

<hr>
Static methods defined here:<br>
<dl><dt><a name="Resampled-__new__"><strong>__new__</strong></a>(_cls, period, phase, method, substream)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>method</strong></dt>
<dd><tt>itemgetter(item,&nbsp;...)&nbsp;--&gt;&nbsp;itemgetter&nbsp;object<br>
&nbsp;<br>
Return&nbsp;a&nbsp;callable&nbsp;object&nbsp;that&nbsp;fetches&nbsp;the&nbsp;given&nbsp;item(s)&nbsp;from&nbsp;its&nbsp;operand.<br>
After,&nbsp;f=itemgetter(2),&nbsp;the&nbsp;call&nbsp;f(r)&nbsp;returns&nbsp;r[2].<br>
After,&nbsp;g=itemgetter(2,5,3),&nbsp;the&nbsp;call&nbsp;g(r)&nbsp;returns&nbsp;(r[2],&nbsp;r[5],&nbsp;r[3])</tt></dd>
</dl>
<dl><dt><strong>period</strong></dt>
<dd><tt>itemgetter(item,&nbsp;...)&nbsp;--&gt;&nbsp;itemgetter&nbsp;object<br>
&nbsp;<br>
Return&nbsp;a&nbsp;callable&nbsp;object&nbsp;that&nbsp;fetches&nbsp;the&nbsp;given&nbsp;item(s)&nbsp;from&nbsp;its&nbsp;operand.<br>
After,&nbsp;f=itemgetter(2),&nbsp;the&nbsp;call&nbsp;f(r)&nbsp;returns&nbsp;r[2].<br>
After,&nbsp;g=itemgetter(2,5,3),&nbsp;the&nbsp;call&nbsp;g(r)&nbsp;returns&nbsp;(r[2],&nbsp;r[5],&nbsp;r[3])</tt></dd>
</dl>
<dl><dt><strong>phase</strong></dt>
<dd><tt>itemgetter(item,&nbsp;...)&nbsp;--&gt;&nbsp;itemgetter&nbsp;object<br>
&nbsp;<br>
Return&nbsp;a&nbsp;callable&nbsp;object&nbsp;that&nbsp;fetches&nbsp;the&nbsp;given&nbsp;item(s)&nbsp;from&nbsp;its&nbsp;operand.<br>
After,&nbsp;f=itemgetter(2),&nbsp;the&nbsp;call&nbsp;f(r)&nbsp;returns&nbsp;r[2].<br>
After,&nbsp;g=itemgetter(2,5,3),&nbsp;the&nbsp;call&nbsp;g(r)&nbsp;returns&nbsp;(r[2],&nbsp;r[5],&nbsp;r[3])</tt></dd>
</dl>
<dl><dt><strong>substream</strong></dt>
<dd><tt>itemgetter(item,&nbsp;...)&nbsp;--&gt;&nbsp;itemgetter&nbsp;object<br>
&nbsp;<br>
Return&nbsp;a&nbsp;callable&nbsp;object&nbsp;that&nbsp;fetches&nbsp;the&nbsp;given&nbsp;item(s)&nbsp;from&nbsp;its&nbsp;operand.<br>
After,&nbsp;f=itemgetter(2),&nbsp;the&nbsp;call&nbsp;f(r)&nbsp;returns&nbsp;r[2].<br>
After,&nbsp;g=itemgetter(2,5,3),&nbsp;the&nbsp;call&nbsp;g(r)&nbsp;returns&nbsp;(r[2],&nbsp;r[5],&nbsp;r[3])</tt></dd>
</dl>
<hr>
Methods inherited from <a href="__builtin__.html#tuple">__builtin__.tuple</a>:<br>
<dl><dt><a name="Resampled-__add__"><strong>__add__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__add__">__add__</a>(y)&nbsp;&lt;==&gt;&nbsp;x+y</tt></dd></dl>

<dl><dt><a name="Resampled-__contains__"><strong>__contains__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__contains__">__contains__</a>(y)&nbsp;&lt;==&gt;&nbsp;y&nbsp;in&nbsp;x</tt></dd></dl>

<dl><dt><a name="Resampled-__eq__"><strong>__eq__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__eq__">__eq__</a>(y)&nbsp;&lt;==&gt;&nbsp;x==y</tt></dd></dl>

<dl><dt><a name="Resampled-__ge__"><strong>__ge__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__ge__">__ge__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&gt;=y</tt></dd></dl>

<dl><dt><a name="Resampled-__getattribute__"><strong>__getattribute__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__getattribute__">__getattribute__</a>('name')&nbsp;&lt;==&gt;&nbsp;x.name</tt></dd></dl>

<dl><dt><a name="Resampled-__getitem__"><strong>__getitem__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__getitem__">__getitem__</a>(y)&nbsp;&lt;==&gt;&nbsp;x[y]</tt></dd></dl>

<dl><dt><a name="Resampled-__getslice__"><strong>__getslice__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__getslice__">__getslice__</a>(i,&nbsp;j)&nbsp;&lt;==&gt;&nbsp;x[i:j]<br>
&nbsp;<br>
Use&nbsp;of&nbsp;negative&nbsp;indices&nbsp;is&nbsp;not&nbsp;supported.</tt></dd></dl>

<dl><dt><a name="Resampled-__gt__"><strong>__gt__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__gt__">__gt__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&gt;y</tt></dd></dl>

<dl><dt><a name="Resampled-__hash__"><strong>__hash__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__hash__">__hash__</a>()&nbsp;&lt;==&gt;&nbsp;hash(x)</tt></dd></dl>

<dl><dt><a name="Resampled-__iter__"><strong>__iter__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__iter__">__iter__</a>()&nbsp;&lt;==&gt;&nbsp;iter(x)</tt></dd></dl>

<dl><dt><a name="Resampled-__le__"><strong>__le__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__le__">__le__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&lt;=y</tt></dd></dl>

<dl><dt><a name="Resampled-__len__"><strong>__len__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__len__">__len__</a>()&nbsp;&lt;==&gt;&nbsp;len(x)</tt></dd></dl>

<dl><dt><a name="Resampled-__lt__"><strong>__lt__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__lt__">__lt__</a>(y)&nbsp;&lt;==&gt;&nbsp;x&lt;y</tt></dd></dl>

<dl><dt><a name="Resampled-__mul__"><strong>__mul__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__mul__">__mul__</a>(n)&nbsp;&lt;==&gt;&nbsp;x*n</tt></dd></dl>

<dl><dt><a name="Resampled-__ne__"><strong>__ne__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__ne__">__ne__</a>(y)&nbsp;&lt;==&gt;&nbsp;x!=y</tt></dd></dl>

<dl><dt><a name="Resampled-__rmul__"><strong>__rmul__</strong></a>(...)</dt><dd><tt>x.<a href="#Substream-__rmul__">__rmul__</a>(n)&nbsp;&lt;==&gt;&nbsp;n*x</tt></dd></dl>

<dl><dt><a name="Resampled-__sizeof__"><strong>__sizeof__</strong></a>(...)</dt><dd><tt>T.<a href="#Substream-__sizeof__">__sizeof__</a>()&nbsp;--&nbsp;size&nbsp;of&nbsp;T&nbsp;in&nbsp;memory,&nbsp;in&nbsp;bytes</tt></dd></dl>

<dl><dt><a name="Resampled-count"><strong>count</strong></a>(...)</dt><dd><tt>T.<a href="#Substream-count">count</a>(value)&nbsp;-&gt;&nbsp;integer&nbsp;--&nbsp;return&nbsp;number&nbsp;of&nbsp;occurrences&nbsp;of&nbsp;value</tt></dd></dl>

<dl><dt><a name="Resampled-index"><strong>index</strong></a>(...)</dt><dd><tt>T.<a href="#Substream-index">index</a>(value,&nbsp;[start,&nbsp;[stop]])&nbsp;-&gt;&nbsp;integer&nbsp;--&nbsp;return&nbsp;first&nbsp;index&nbsp;of&nbsp;value.<br>
Raises&nbsp;ValueError&nbsp;if&nbsp;the&nbsp;value&nbsp;is&nbsp;not&nbsp;present.</tt></dd></dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>REPO_ROOT</strong> = 'jackalope.cs.berkeley.edu/django'</td></tr></table>
</body></html>